package pers.whj.util.graph;

public interface Graph<T> {
    // return true if it is a directed graph
    boolean isDirected();

    // return true if there are no edges
    boolean isEmpty();

    boolean isFull();

    boolean isCompleteGraph();

    int maxVertices();

    int numOfVertices();

    long numOfEdges();

    // get the position of this vertex in graph
    int getPosition(T vertex);

    T getValue(int v);

    void setValue(int v, T data);

    void setValue(T preData, T data);

    int getFirstNeighbor(int v);

    int getNextNeighbor(int v, int w);

    // return the index of vertex, if fail then return -1
    int insertVertex(T vertex);

    boolean insertEdge(int v1, int v2);

    boolean insertEdge(T vertex1, T vertex2);

    boolean removeVertex(int v);

    boolean removeVertex(T vertex);

    boolean removeEdge(int v1, int v2);

    boolean removeEdge(T vertex1, T vertex2);

    boolean hasEdge(int v1, int v2);

    boolean hasEdge(T vertex1, T vertex2);

    void removeAllEdges();

    void clear();

    boolean resize(int maxVertices);
}